package com.zhuoyue.biz.core.api.service.impl;

import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhuoyue.biz.core.api.dao.ProductInfoAppMapper;
import com.zhuoyue.biz.core.api.domain.ProductInfoApp;

/**
 * @author wjming
 */
@Service
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class ProductInfoAppService extends ServiceImpl<ProductInfoAppMapper, ProductInfoApp> {
    private final ProductInfoAppMapper productInfoAppMapper;

    /**
     * 获取产品功能信息
     *
     * @param prodId
     * @return
     */
    public List<String> getDeviceFun(String prodId) {
        String functions = productInfoAppMapper.selectDeviceFunction(prodId);
        if (StringUtils.isNotEmpty(functions)) {
            String str[] = functions.split(",");
            return Arrays.asList(str);
        } else {
            return Collections.emptyList();
        }
    }
}
